// src/utils/auth.js

const TOKEN_KEY = 'zhongxin_token'

// 保存token到localStorage
export function setToken(token) {
  localStorage.setItem(TOKEN_KEY, token)
}

// 从localStorage获取token
export function getToken() {
  return localStorage.getItem(TOKEN_KEY)
}

// 从localStorage移除token
export function removeToken() {
  localStorage.removeItem(TOKEN_KEY)
}

// 检查是否已登录
export function isAuthenticated() {
  return !!getToken()
}
